package leetcode_201_300;

import node.TreeNode;

public class LeeCode_222 {
    public static void main(String[] args) {

    }
    private static int countNodes(TreeNode root) {
        return dfs(root, 0);
    }
    private static int dfs(TreeNode node, int sum){
        if (node == null)
            return 0;
        return sum + 1 + dfs(node.left, 0) + dfs(node. right, 0);
    }
}
